//
//  subListTableViewCell.m
//  Romens.XSBalance
//
//  Created by 李美东 on 16/2/26.
//  Copyright © 2016年 孙博. All rights reserved.
//

#import "subListTableViewCell.h"
#import "ToolHelper.h"
@implementation subListTableViewCell

// 方法重载
-(id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self=[super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if(self)
    {
        [self awakeFromNib];
    }
    return self;
}
- (void)awakeFromNib {
    // Initialization code
    _subImage=[[UIImageView alloc]init];
    _subImage.translatesAutoresizingMaskIntoConstraints=NO;
    [self.contentView addSubview:_subImage];
    
    self.subNameLabel=[[UILabel alloc]init];
    self.subNameLabel.translatesAutoresizingMaskIntoConstraints=NO;
    self.subNameLabel.font=systemFont(16);
//    [self.subNameLabel sizeToFit];
    [self.contentView addSubview:self.subNameLabel];
    
    _subArrowImage=[[UIImageView alloc]init];
    _subArrowImage.translatesAutoresizingMaskIntoConstraints=NO;
    [self.contentView addSubview:_subArrowImage];
    
    [self.contentView addConstraints:[ToolHelper GetNSLayoutCont:NSDictionaryOfVariableBindings(_subImage,_subNameLabel,_subArrowImage) format:@"H:|-44-[_subImage(20)]-2-[_subNameLabel]-[_subArrowImage(20)]-8-|"]];
    
    [self.contentView addConstraints:[ToolHelper GetNSLayoutCont:NSDictionaryOfVariableBindings(_subImage) format:@"V:[_subImage(20)]"]];
    [self.contentView addConstraint:[NSLayoutConstraint constraintWithItem:_subImage
                                                                 attribute:NSLayoutAttributeCenterY
                                                                 relatedBy:NSLayoutRelationEqual
                                                                    toItem:self.contentView                                              attribute:NSLayoutAttributeCenterY
                                                                multiplier:1.0f
                                                                  constant:0]];
    [self.contentView addConstraints:[ToolHelper GetNSLayoutCont:NSDictionaryOfVariableBindings(_subArrowImage) format:@"V:[_subArrowImage(20)]"]];
    [self.contentView addConstraint:[NSLayoutConstraint constraintWithItem:_subArrowImage
                                                                 attribute:NSLayoutAttributeCenterY
                                                                 relatedBy:NSLayoutRelationEqual
                                                                    toItem:self.contentView                                              attribute:NSLayoutAttributeCenterY
                                                                multiplier:1.0f
                                                                  constant:0]];

    [self.contentView addConstraints:[ToolHelper GetNSLayoutCont:NSDictionaryOfVariableBindings(_subNameLabel) format:@"V:|[_subNameLabel]|"]];
    
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    
    // Configure the view for the selected state
}

@end
